package mt.dummy;

import static org.junit.Assert.*;
import mt.*;

import mt.comm.ServerSideMessage;

import org.junit.Test;

public class ServerCommDummyTest {

	ServerCommDummy server= new ServerCommDummy();
	ClientCommDummy client1= new ClientCommDummy();
	ClientCommDummy client2=  new ClientCommDummy();
	Order order = Order.createBuyOrder("teste","teste", 10, 11.1);

	@Test
	public void testAddMessage() {

		server.addMessage(new ServerMessage(ServerSideMessage.Type.NEW_ORDER,"teste", order));
	}

	@Test
	public void testStart() {
		//		server.start();


	}

	@Test
	public void testHasNextMessage() {
		assertFalse(server.hasNextMessage());
		server.addMessage(new ServerMessage(ServerSideMessage.Type.NEW_ORDER,"teste", order));
		assertTrue(server.hasNextMessage());
	}

	@Test
	public void testGetNextMessage() {
		assertFalse(server.hasNextMessage());
		server.addMessage(new ServerMessage(ServerSideMessage.Type.NEW_ORDER,"teste", order));
		assertTrue(server.hasNextMessage());
		server.getNextMessage();


	}

	@Test
	public void testSendError() {
		server.clientIsConnected("teste");
		client1.connect(null,"nickname");
		server.sendError("nickname", "teste");


	}

	@Test
	public void testClientIsConnected() {
		assertFalse(server.clientIsConnected("teste"));
		//		server.start();
		//		client1.connect(null,"nickname");
		//		assertTrue(server.clientIsConnected("nickname"));
	}


	@Test
	public void testDisconnectClient() {
		assertFalse(server.clientIsConnected("teste"));
	}

	@Test
	public void testSendOrder() {
		server.sendOrder("teste", order);

	}

}
